import org.sword.wechat4j.api.WechatClient
import org.sword.wechat4j.util.ImageUpload

/**
 *
 * Created by wxc on 2016/8/18 0018.
 */
class ImageUploadParseTest {

    static token = "EvXmqg7lqMs8Z4Ji32-SKwWyA9baaZoRO_TcZXdYLBkLnEzOVSYQeuWR_sl7Wdd-pepb6RXmwKLpgHZzM0PRdMMHta2KI6DveW5mo7DA8D5e9Hk8GcjhYpBLZRvmesJAHBZgAHARLJ"

    static main(args) {

        def content = readFile("C:\\Users\\wxc\\Desktop\\抓取\\复杂刀具廓形的磨削加工如何处理？答案在这里！.html")

        def parse = new ImageUpload()
        def list = []
        println parse.replaceImageUrlAfterUpload(content, list, new WechatClient(), token)
        println list
    }

    static readFile(path) {
        def reader= new BufferedReader(new FileReader(path))
        def tmp
        def bd = new StringBuilder()
        while (tmp = reader.readLine())
            bd.append(tmp)
        reader.close()
        bd.toString()
    }
}
